<?
if (!defined('SMF'))
	die('Hacking attempt...');

global $smcFunc, $txt, $scripturl;
global $dbtables;

//-------------------------------------------------------------------------------------------------

TEXT_JAVASCRIPT_BEGIN();

$newspath = $scripturl . "?action=blacknova;sa=news";
$startdate = date("Y/m/d");

$result = $smcFunc['db_query']('', '
	SELECT *
	FROM {raw:db_news}
	WHERE date > {string:starttime}
	AND date < {string:endtime}
	ORDER BY news_id',
	array(
		'db_news' => $dbtables['news'],
		'starttime' => $startdate . ' 00:00:00',
		'endtime' => $startdate . ' 23:59:59'
	)
);
echo chr(10), '
											var fader = new Array();
											fader[0] = new fadeObject(\'fader\', \'500050\', \'00df05\', 30, 30);';

// Populate the javascript fader array.
if ($smcFunc['db_num_rows']($result) == 0)
{
	// No news today/
	echo '
											fader[0].msg[1] = \'<a href="', $newspath, '">', $txt['bnt_news_none'], '</a>\';', chr(10);
}
else
{
	// While there are news results . . .
	$i = 1;
	while ($row = $smcFunc['db_fetch_assoc']($result)) 
	{
		echo '
											fader[0].msg[', $i, '] = \'<a href="', $newspath, '">', $row['headline'], '</a>\';', chr(10);
		$i++;
	}
	
	//Done echoing out the news.
	echo '
											fader[0].msg[', $i, '] = \'<a href="', $newspath, '">', $txt['bnt_news_end'], '</a>\';', chr(10);
}
$smcFunc['db_free_result']($result);

echo '
											setTimeout(function() { throb(0); }, 1000);', chr(10);

TEXT_JAVASCRIPT_END();

echo '
								<h4 class="bnt_header_title"><a href="', $scripturl, '?action=blacknova;sa=news">BlackNova News Network</a></h4>
								<ul>
									<li><div id="fader"></div></li>
								</ul>
								<script>
									$(\'.bnt_header_title\').corners("top-left top-right no-native");
								</script>';
?>


